package com.lfy.listen;

import com.lfy.conf.MqConf;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

//@Component
public class UserListener {
    @RabbitListener(queues = MqConf.Mq_Q)
    public void Str(Message message, Object s, Channel channel){
        System.out.println("收到消息"+s);
        System.out.println("+++++++++++++++++++++++++++++");
        try {
            channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
